<template>
  <div>
    <h1>产品管理</h1>
    <el-form :inline="true" :model="zero" class="demo-form-inline">
      <el-form-item label="产品名称">
        <el-input v-model="zero.tradeName" placeholder="产品名称"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="list">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table
        :data="tableData"
        border
        style="width: 100%">
      <el-table-column
          fixed
          prop="outTradeNo"
          label="产品编号"
          width="150">
      </el-table-column>
      <el-table-column
          prop="tradeName"
          label="产品名称"
          width="120">
      </el-table-column>
      <el-table-column
          prop="totalPrice"
          label="总价格"
          width="120">
      </el-table-column>
      <el-table-column
          prop="source"
          label="产品来源"
          width="120">
      </el-table-column>
      <el-table-column
          prop="indate"
          label="时间"
          width="300">
      </el-table-column>
      <el-table-column
          prop="status"
          label="状态"
          width="120">
        <template v-slot="s">
          <el-col v-if="s.row.status==1">已签收</el-col>
          <el-col v-if="s.row.status==0">未签收</el-col>
        </template>
      </el-table-column>
      <el-table-column
          fixed="right"
          label="操作"
          width="100">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
          <el-button type="text" size="small">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
        @current-change="goPage"
        :current-page.sync="page.pageNum"
        :page-size="page.pageSize"
        layout="total, prev, pager, next"
        :total="total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "ZeroView",
  data(){
    return{
      tableData:[],
      page:{
        pageNum:1,
        pageSize:10
      },
      zero:{},
      total:0,
    }
  },methods:{
    goPage(pageNum){
      this.page.pageNum=pageNum;
      this.list();
    },
    list(){
      this.axios.post("/zero/list?page="+this.page+"zero="+this.zero).then(res=>{
        this.tableData=res.data.data.list;
        this.total=res.data.data.total;
      })
    }
  },created() {
    this.list();
  }
}
</script>

<style scoped>

</style>